package day;

public class P600 {
    public int findIntegers(int n) {
        int len = 0;
        if (n == 0) {
            return 1;
        }
        int tmp = 0;
        do {
            tmp = (int) Math.pow(2, ++len);
        } while (tmp < n);
        //
        int total = 1;
        for (int i = 1; i <= n; i++) {
            String str = Integer.toBinaryString(i);
            boolean flag = true;
            for (int j = 0; j < str.length() - 1; j++) {
                if (str.charAt(j) == '1' && str.charAt(j + 1) == '1') {
                    flag = false;
                    break;
                }
            }
            if (flag) {
                total++;
            }
        }
        return total;
    }

    public static void main(String[] args) {
        int n = new P600().findIntegers(12);
        System.out.println(n);
    }
}
